<?php

namespace app\admin\controller;

use think\Controller;
use think\Db;
use think\Request;

class Con3 extends Controller
{
    public function index()
    {
        $sql = "SELECT * FROM `lamp_node`";

        $list = Db::query($sql);
        return view('admin@con3/tables',['list' => $list]);
    }

    public function func1()
    {
        return view('admin@con3/func1', ['title' => '新增用户']);
    }

    public function func2(Request $request)
    {
        $p = $request->get();
        $data = [
            'name' => $p['name'],
            'mname' => $p['mname'],
            'aname' => $p['aname'],
            'status' => $p['status'],
       ];

        $result = Db::table('lamp_node')->data($data)->insert();

        if ($result >0 ){
            return $this->success('新增成功',url('admin/Con3/index'));
        }else{
            return $this->success('新增失败');
        }
    }
}
